package com.lqzs.businessmanager.bean

import android.os.Parcel
import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "meituan_table")
class AccessInfo() : Parcelable {
    @PrimaryKey(autoGenerate = true)
    var uid =0 //主键自增长ID
    @ColumnInfo(name = "time")
    var time:String?=null //日期
    @ColumnInfo(name = "content")
    var content:String?=null //商家名称、评分、内容、点赞名称、订单详情
    @ColumnInfo(name = "orderDetails")
    var orderDetails:String?=null //订单详情
    @ColumnInfo(name = "chaseComments")
    var chaseComments:String?=null //追评
    @ColumnInfo(name = "merchantReplied")
    var merchantReplied:String?=null //商家回复
    @ColumnInfo(name = "reviewId")
    var reviewId:String?=null //评论ID
    @ColumnInfo(name = "upload")
    var upload = 0//是否上传后台0未上传，1上传,3需要更新

    constructor(parcel: Parcel) : this() {
        uid = parcel.readInt()
        time = parcel.readString()
        content = parcel.readString()
        orderDetails = parcel.readString()
        chaseComments = parcel.readString()
        merchantReplied = parcel.readString()
        reviewId = parcel.readString()
        upload = parcel.readInt()
    }

    override fun toString(): String {
        return "AccessInfo(uid=$uid, time=$time,content='$content', orderDetails='$orderDetails',chaseComments='$chaseComments',  merchantReplied='$merchantReplied',reviewId='$reviewId',upload='$upload')"
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeInt(uid)
        parcel.writeString(time)
        parcel.writeString(content)
        parcel.writeString(orderDetails)
        parcel.writeString(chaseComments)
        parcel.writeString(merchantReplied)
        parcel.writeString(reviewId)
        parcel.writeInt(upload)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<AccessInfo> {
        override fun createFromParcel(parcel: Parcel): AccessInfo {
            return AccessInfo(parcel)
        }

        override fun newArray(size: Int): Array<AccessInfo?> {
            return arrayOfNulls(size)
        }
    }

}